~ chicken-core (chicken-5) /manual/Module (chicken csi)
Trap1[[tags: manual]]
2[[toc:]]
3
4== Module (chicken csi)
5
6This module provides procedures to access features specific to
7the {{csi}} interactive interpreter.
8
9=== toplevel-command
10
11<procedure>(toplevel-command SYMBOL PROC [HELPSTRING])</procedure>
12
13Defines or redefines a toplevel interpreter command which can be invoked by entering
14{{,SYMBOL}}. {{PROC}} will be invoked when the command is entered and may
15read any required argument via {{read}} (or {{read-line}}). If the optional
16argument {{HELPSTRING}} is given, it will be listed by the {{,?}} command.
17
18
19=== set-describer!
20
21<procedure>(set-describer! TAG PROC)</procedure>
22
23Sets a custom description handler that invokes {{PROC}} when the
24{{,d}} command is invoked with a record-type object that has the type
25{{TAG}} (a symbol). {{PROC}} is called with two arguments: the object
26to be described and an output-port. It should write a possibly useful
27textual description of the object to the passed output-port. For
28example:
29
30 #;1> (define-record-type point (make-point x y) point?
31 (x point-x)
32 (y point-y))
33 #;2> (set-describer! 'point
34 (lambda (pt o)
35 (with-output-to-port o
36 (lambda ()
37 (print "a point with x=" (point-x pt) " and y=" (point-y pt))))))
38 #;3> ,d (make-point 1 2)
39 a point with x=1 and y=2
40
41
42=== default-evaluator
43
44<procedure>(default-evaluator EXPR)</procedure>
45
46Takes {{EXPR}} and processes any of the built-in toplevel commands provided
47by {{csi}}. If {{EXPR}} is not a toplevel command, then it is evaluated using
48{{eval}}. This procedure is intended to be passed as an argument to {{repl}}
49to allow using {{csi}}s toplevel commands and history management in user-defined
50read-eval-print loops.
51
52
53=== editor-command
54
55<parameter>editor-command</parameter>
56
57Holds the name of an editor that should be used when the toplevel
58command {{,e}} is used.
59
60
61---
62Previous: [[Module (chicken continuation)]]
63
64Next: [[Module (chicken errno)]]